package net.wanho.cloudconsumer7001.client;

import net.wanho.cloudconsumer7001.config.MyLoadBalancerConfig;
import net.wanho.entity.User;
import net.wanho.vo.AjaxResult;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@FeignClient(value = "cloud-gateway",path = "/api/v2",fallback = UserClientFallback.class)
@LoadBalancerClients(defaultConfiguration= {MyLoadBalancerConfig.class})
public interface UserClient {
    @GetMapping("/user/test")
    String test();

    @GetMapping("/user")
    AjaxResult findByName(@RequestParam("name") String name);

    @DeleteMapping("/user/{id}")
    AjaxResult deleteById(@PathVariable("id") Integer id);

    @PostMapping("/user")
    AjaxResult addUser(@RequestBody User user);

    @PutMapping("/user")
    AjaxResult updateUser(@RequestBody User user);

    @GetMapping("/user/query")
    AjaxResult queryUser(@RequestParam HashMap<String, Object> map);
}
